package org.wyn.mongodb.bean;

import java.util.LinkedList;
import java.util.List;

import org.bson.types.ObjectId;
import org.wyn.common.Table;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

/**
 * 
 * 留言实体类,一个用户的所有留言存在一个doc中
 * @author wyn
 *
 */
@Entity(value=Table.CollectionName.MESSAGE,noClassnameStored=true)
public class Message{
	public Message(){
		
	}
	public Message(String userName){
		this.userName = userName;
	}
	@Id
	private String userName;//被留言的用户
	private List<Mee> mees = new LinkedList<Mee>();
	
	/**
	 * 一条留言
	 * @author wyn
	 *
	 */
	public static class Mee{
		public Mee(){
			
		}
		public Mee(String userName,String realName,String content,ObjectId portrait){
			this.userName = userName;
			this.realName = realName;
			this.content = content;
			this.portrait = portrait;
			this.createTime = System.currentTimeMillis();
		}
		private String userName;//留言者
		private String realName;//留言者真实姓名
		private String content;//留言内容
		private long createTime;//留言时间
		private ObjectId portrait = new ObjectId();//留言者头像
		public String getUserName() {
			return userName;
		}
		public void setUserName(String userName) {
			this.userName = userName;
		}
		public String getContent() {
			return content;
		}
		public void setContent(String content) {
			this.content = content;
		}
		public long getCreateTime() {
			return createTime;
		}
		public void setCreateTime(long createTime) {
			this.createTime = createTime;
		}
		public String getRealName() {
			return realName;
		}
		public void setRealName(String realName) {
			this.realName = realName;
		}
		public ObjectId getPortrait() {
			return portrait;
		}
		public void setPortrait(ObjectId portrait) {
			this.portrait = portrait;
		}
		
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public List<Mee> getMees() {
		return mees;
	}

	public void setMees(List<Mee> mees) {
		this.mees = mees;
	}
}
